package io.renren.membermanage.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import io.renren.enums.ModelType;
import io.renren.enums.SamplerNameEnum;
import io.renren.enums.ScheduleTypeEnum;
import io.renren.enums.UpScalarEnum;
import io.renren.membermanage.bo.KeywordListBO;
import io.renren.util.ApiResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/dictionary")
@Tag(name = "常量字典")
public class ConstDictionaryController {

    @SaCheckLogin
    @GetMapping("/getSamplerName")
    @Operation(summary = "获取采样器名称", description = "获取采样器名称")
    public ApiResult<List<String>> getAllSamplerName() {
        List<String> allName = SamplerNameEnum.getAllName();
        return ApiResult.success(allName);
    }

    @SaCheckLogin
    @GetMapping("/getScheduleType")
    @Operation(summary = "获取调度类型", description = "获取调度类型")
    public ApiResult<List<String>> getScheduleType() {
        List<String> allName = ScheduleTypeEnum.getAllName();
        return ApiResult.success(allName);
    }

    @SaCheckLogin
    @GetMapping("/getUpScalar")
    @Operation(summary = "获取放大器", description = "获取放大器")
    public ApiResult<List<String>> getUpScalar(){
        List<String> allName = UpScalarEnum.getAllNames();
        return ApiResult.success(allName);
    }

    @SaCheckLogin
    @GetMapping("/getModelType")
    @Operation(summary = "获取模型类型", description = "获取模型类型")
    @ApiResponses(value ={
            @ApiResponse(responseCode = "200", description = "请求成功",
                    content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema( implementation = Map.class)))),
            @ApiResponse(responseCode = "400", description = "请求失败", content = @Content)
    })
    public ApiResult<List<Map<String,String>>> getModelType(){
        return ApiResult.success(ModelType.getMap());
    }
}
